package com.ceshiren.test.houduankaifa.service.impl;

import com.ceshiren.test.houduankaifa.dto.UserDto;
import com.ceshiren.test.houduankaifa.service.UserService;
import com.ceshiren.test.houduankaifa.util.Result;
import org.springframework.stereotype.Service;

@Service
public class UserServiceImpl implements UserService {



    @Override
    public String login(UserDto userDto) {
        if (userDto.getUsername().equals("ceshiren") && userDto.getPassword().equals("123456")) {
            return "登陆成功！！！登录的用户名为：" + userDto.getUsername() + "密码为：" + userDto.getPassword() +" IOC";
        } else {
            return "登陆失败!!!登录的用户名为：" + userDto.getUsername() + "密码为：" + userDto.getPassword()+" IOC";
        }
    }

    @Override
    public String register(UserDto userDto) {
        return "注册用户名：" + userDto.getUsername() + ",\n注册密码：" + userDto.getPassword() +" IOC";
    }

    @Override
    public Result addUser(UserDto userDto) {
        if (userDto.getUsername().equals("ceshiren") && userDto.getPassword().equals("123456")) {
            return Result.success().data(userDto).msg("添加用户成功");
        }else {
            return Result.error().data(userDto).msg("添加用户失败");
        }
    }
}
